
package com.zsrt.day20170427.ch02;


import java.lang.annotation.Annotation;

import org.junit.Test;

public class AnotationTest {

	@Test
	public void test01() throws Exception {
		
		@SuppressWarnings("rawtypes")
		Class clazz = Class.forName("com.zsrt.day20170427.ch02.StudentServiceImpl");
		
		Annotation[] annotations = clazz.getAnnotations();
		for(Annotation annotation: annotations){
			
			//强制转化成 service型注解
			Service service = (Service) annotation;
			String name = service.getName();
			int age = service.getAge();
			System.err.println(name);
			System.out.println(age);
		}
		
	} 
}
